home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Technotools
/
Technotools (Chestnut CD-ROM)(1993).ISO
/
lang_bas
/
fossc004
/
term.bas
< prev
next >
Wrap
BASIC Source File
|
1988-12-01
|
3KB
|
80 lines
1000 ' -----------------------------------------------------
1010 ' This is a demonstration program for use with FossComm
1020 ' -----------------------------------------------------
1030 ' set parameters for COM1
1040 ' -----------------------
1050 FOX$ = "The quick brown fox jumps over the lazy dog"+CHR$(10)+CHR$(13)
1060 COMPORT% = 0
1070 COMSPEED% = 2400
1071 COMPARITY% = 0
1072 COMDATABITS% = 3
1073 COMSTOPBITS% = 0
1080 DTRSTATE% = 1
1090 LOCATE 1,1,1
1100 ' ---------------------
1110 ' initialize the driver
1120 ' ---------------------
1130 CALL FOSINIT(COMPORT%,RESULT%)
1140 IF RESULT% = -1 THEN PRINT "Error initializing FOSSIL driver":END
1150 ' -------------
1160 ' set the speed
1170 ' -------------
1180 CALL FOSSPEED(COMPORT%, COMSPEED%, COMPARITY%, COMDATABITS%, COMSTOPBITS%)
1190 ' ---------------------
1200 ' this is the main loop
1210 ' ---------------------
1220 CLS
1230 MORE% = 1
1240 WHILE MORE%
1250 IN$ = INKEY$
1260 ' --------------------
1270 ' check extended chars
1280 ' --------------------
1290 IF LEN(IN$) > 1 THEN GOSUB 1500
1300 IF IN$ <> "" THEN CHAR% = ASC(IN$):CALL FOSTXCHAR(COMPORT%,CHAR%,RESULT%)
1310 ' --------------
1320 ' check commport
1330 ' --------------
1340 CALL FOSREADAHEAD(COMPORT%,CHAR%)
1350 IF CHAR% <> -1 THEN CALL FOSRXCHAR(COMPORT%,CHAR%):GOSUB 1420
1360 WEND
1370 ' ----------------------------------
1380 ' deinitialize the driver and finish
1390 ' ----------------------------------
1400 CALL FOSEXIT(COMPORT%)
1410 END
1420 ' -------------------------------
1430 ' subroutine to display character
1440 ' -------------------------------
1450 IF CHAR% = 8 THEN IF POS(0) > 1 THEN LOCATE CSRLIN,POS(0)-1:RETURN:ELSE RETURN
1460 IF CHAR% = 13 THEN LOCATE CSRLIN,1 : RETURN
1470 IF CHAR% = 10 THEN IF CSRLIN < 24 THEN LOCATE CSRLIN+1,POS(0):RETURN:ELSE:PRINT "":RETURN
1480 PRINT CHR$(CHAR%);
1490 RETURN
1500 ' ----------------------------------
1510 ' subroutine to handle extended keys
1520 ' ----------------------------------
1530 CHAR% = ASC(MID$(IN$,2,1))
1540 IN$ = ""
1550 ' ---------------
1560 ' ALT-H drops DTR
1570 ' ---------------
1580 IF CHAR% = 35 THEN DTRSTATE% = 0:CALL FOSDTR(COMPORT%,DTRSTATE%):RETURN
1590 ' ----------------
1600 ' ALT-S raises DTR
1610 ' ----------------
1620 IF CHAR% = 31 THEN DTRSTATE% = 1:CALL FOSDTR(COMPORT%,DTRSTATE%):RETURN
1630 ' ----------------------------------
1640 ' F1 transmits 'the quick brown fox'
1650 ' ----------------------------------
1660 IF CHAR% = 59 THEN BYTES% = LEN(FOX$):CALL FOSWRITE(COMPORT%,BYTES%,FOX$):RETURN
1670 ' -----------
1680 ' ALT-X quits
1690 ' -----------
1700 IF CHAR% = 45 THEN GOTO 1400
1710 ' -----------------
1720 ' Ignore other keys
1730 ' -----------------
1740 RETURN